package dk.itu.mmad.returnfromactivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class SubActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.sub);
		
		Button backToMainButton  = (Button) findViewById(R.id.backtomain);
		backToMainButton.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				EditText input = (EditText) findViewById(R.id.inputnumber);
				String inputText = input.getText().toString();
				Intent intent = new Intent();
				intent.putExtra(MainActivity.SUB_RESULT, inputText);
				setResult(RESULT_OK, intent);
				finish();
			}
		});
		
	}

}
